#include <assert.h>
#include <stdio.h>
#include <string.h>

#include <vector>

using namespace std;

int N;
int M;

int A[70];
const int Inf = 999;
int Ans = Inf;
int Mask[70];

bool merge_result;

bool TryMerge(int len, int num) {
    // merge_result = false;
    bool all_gt=true;
    for (int i=0;i<N;++i) {
        if (A[i] <)
    }

}

void Solve() {
  int total_len = 0;
  for (int i = 0; i < N; ++i) {
    total_len += A[i];
  }
  for (int new_N = N; new_N >= 1; ++new_N) {
    if (total_len % new_N != 0) {
      continue;
    }
    int new_len = total_len / new_N;
    bool ok = TryMerge(new_len, new_N);
    if (ok) {
        printf("%d\n", new_len);
        return;
    }
  }
}

int main() {
  freopen("in2.txt", "r", stdin);

  while (scanf("%d", &N), N) {
    for (int i = 0; i < N; ++i) {
      scanf("%d", &A[i]);
    }
    Solve();
  }

  return 0;
}